import request from '@/utils/request'
// 获取部门列表
export function getDepartments() {
  return request({
    url: '/company/department'
  })
}
// 获取部门负责人
export function getEmployees() {
  return request({
    url: '/sys/user/simple'
  })
}
// 新增子部门
/**
 *
 * @param {ComputedEffectTiming,introduce,manager,name,pid} data
 * @returns
 */
export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}
// 获取部门详情
export function getDepartmentsDetai(id) {
  return request({
    url: `/company/department/${id}`
  })
}
// 编辑子部门
/**
 *
 * @param {ComputedEffectTiming,introduce,manager,name,pid} data
 * @returns
 */
export function editDepartments(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
// 删除子部门
export function delDepartments(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}
